package com.novak.rss.reader;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;

public class MainViewActivity extends TabActivity
{
  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Resources res = getResources();
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent().setClass(this, FeedRecommendViewActivity.class);

    spec = tabHost.newTabSpec("recommended_feeds").setIndicator("推荐",
        res.getDrawable(R.drawable.tab)).setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, MyFeedsViewActivity.class);
    spec = tabHost.newTabSpec("my_feeds").setIndicator("我的订阅",
        res.getDrawable(R.drawable.tab)).setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu)
  {
    // TODO Auto-generated method stub
    menu.addSubMenu(0, 2, 0, getResources().getString(R.string.tired));
    menu.addSubMenu(0, 3, 0, getResources().getString(R.string.quit));
    return true;
  }



  @Override
  public boolean onOptionsItemSelected(MenuItem item)
  {
    switch (item.getItemId()){
      case 2:
        toVibrate();
        return true;
      case 3:
        finish();
        return true;
    }
    return false;
  }
  public void toVibrate(){
   Intent intent = new Intent();
   intent.setClass(MainViewActivity.this, VibratorViewActivity.class);
   startActivityForResult(intent, 0);
  }
  
}